package com.xwtec.proxy.v2;

import java.util.Random;

/**
 * @Author: zt
 * @Date: 2021/3/2 21:51
 * 代理模式
 * 利用继承去调用父类方法
 * 慎用继承，代码的耦合度太高
 */
public class Tank implements Movable {
    @Override
    public void move() {

        System.out.println("Tank Move claclacla.....");
        try {
            Thread.sleep(new Random().nextInt(4000));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }


}
 class Tank2 extends Tank{

     @Override
     public void move() {
         long start  = System.currentTimeMillis();
         super.move();
         long end = System.currentTimeMillis();
         System.out.println(end-start);
     }

     public static void main(String[] args) {
         new Tank2().move();
     }
 }

interface Movable{
    void move();
}
